<include file="public@header"/>


</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('AdminArticle/index')}">文章列表</a></li>
    </ul>


    <div class="row ">
        <div style="margin:100px 240px;width:700px;height:300px ">

            <!-- 上传文件 -->
            <form enctype="multipart/form-data" >
                <input id="file-0a" class="file" name="uploadfile" type="file" multiple data-min-file-count="1">
            </form>


            <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('AdminArticle/leadPost')}">

                <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="form-required">*</span>名称:</label>
                    <div class="col-md-6 col-sm-10">
                        <select class="form-control" name="category_id" style="width: 140px;">
                            <option value='0'>请选择分类</option>
                            {$categoryTree|default=''}
                        </select>&nbsp;
                        <input type="hidden" name="filedata" id="filedata" value=""/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="form-required">*</span>文章处理:</label>
                    <div class="col-md-6 col-sm-10">
                        <select class="form-control" name="deal_type" style="width: 140px;">
                            <option value='0'>对文章翻译</option>
                            <option value='1'>同义词替换</option>
                            <option value='-1'>不做处理</option>
                        </select>
                    </div>
                </div>
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-primary js-ajax-submit">{:lang("SAVE")}</button>
                    <a class="btn btn-default" href="__URL__">返回</a>
                </div>
            </form>

        </div>
    </div>

    <script>

        $('#file-0a').fileinput({

        'theme':'explorer',
        uploadUrl:"{:url('AdminArticle/receiveFile')}",

        showPreview:true,//是否显示预览

        allowedFileExtensions : ['xlsx','xls'],

        maxFileCount :1

        });

        $('#file-0a').on('fileuploaderror',function(event, data, previewId, index) {


         console.log(33)
         console.log(data);

        console.log('File upload error');

        });

        $('#file-0a').on('fileerror',function(event, data) {
            console.log(22)
        console.log(data);

        });

        $('#file-0a').on('fileuploaded',function(event, data, previewId, index) {

            console.log(11)
            if(data.response.code == 0){
                alert("上传失败");return;
            }
            console.log(data.response)
            console.log(JSON.stringify(data.response.data ))
            $("#filedata").val(JSON.stringify(data.response.data ));
            console.log(data);


        });

    </script>


</div>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>